import java.util.*;

class Solution {
    public char firstUniqChar(String s) {
        HashMap<Character, Integer> map = new HashMap<>();
        char[] chars = s.toCharArray();
        for (char aChar : chars) {
            map.put(aChar, map.getOrDefault(aChar, 0) + 1);
        }
        for (char aChar : chars) {
            if (map.get(aChar) == 1) return aChar;
        }
        return ' ';
    }
}

